package edu.nf.admin.controller.item;

import edu.nf.admin.controller.BaseController;
import edu.nf.waimai.service.item.ItemService;
import edu.nf.waimai.service.item.impl.ItemServiceImpl;
import org.nf.web.annotation.RequestMapping;
import org.nf.web.annotation.RequestParam;
import org.nf.web.servlet.View;
import org.nf.web.servlet.view.JsonView;

public class ItemController extends BaseController {
    private ItemService service = new ItemServiceImpl();

    /**
     * 访问全部商品
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/item/getItemList")
    public View getItemList(){
        return new JsonView(success(service.listItem()));
    }

    /**
     * 通过id删除商品
     * @param itemId
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/item/delItem")
    public View delItem(@RequestParam("itemId") int itemId){
        return new JsonView(success(service.delItemById(itemId)));
    }
}